package com.cbs.android.component.toast.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.View;

import com.cbs.android.component.toast.Toast;
import com.cbs.android.component.toast.ToastConfig;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toast.init(this);
    }

    public void basic(View view) {
        Toast.show("Basic", Toast.LENGTH_SHORT);
    }

    public void gravity(View view) {
        ToastConfig config = new ToastConfig()
                .setContent("Gravity")
                .setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP, 100, 100);
        Toast.show(config);
    }

    public void margin(View view) {
        ToastConfig config = new ToastConfig()
                .setContent("Margin")
                .setGravity(Gravity.LEFT | Gravity.TOP, 0, 0)
                .setMargin(0.5f, 0.5f);
        Toast.show(config);
    }

    public void custom(View view) {
        ToastConfig config = new ToastConfig()
                .setContent("Custom")
                .setDuration(Toast.LENGTH_LONG)
                .setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 0)
                .setMargin(0.1f, 0.5f)
                .setView(this, R.layout.toast);
        Toast.show(config);

    }
}
